{% extends "base.html" %}
{% block title %}登录{% endblock %}
{% block css %}
<link href="/lift_main/static/src/css/wechat_bind.css" rel="stylesheet">
{% endblock %}w
{% block js %}
{% endblock %}
{% block content %}

<div class="login">
    <div class="logo">
        <img src="/lift_main/static/src/img/logo.png" alt="">
    </div>
    <div  class="login-form">
        <div class="login-box">
            <label for="" ><i class="fa fa-user-o"></i></label>
            <input type="text" class="inputtype" id="username" placeholder="用户名" autocomplete="off"/>
        </div>
        <div class="login-box">
            <label for=""><i class="fa fa-key"></i></label>
            <input type="password" class="inputtype" id="password" placeholder="密码" autocomplete="off"/>
        </div>
        <div class="login-err-info">
            <span id="login_err_info"></span>
        </div>
        <div class="login-sign">
            <span class="sign-link" id="login">登&nbsp;录</span>
        </div>
    </div>
    <div class="login-copyright">
        <p>copyright© 江苏天益网络技术有限公司</p>
    </div>
</div>

<script>
$(function(){
    $("#login").click(function(){
        $.ajax({
            url:'/mainlogin',
            data:{
                'login':$("#username").val(),
                'password':$("#password").val()
            },
            dataType:'json',
            success:function(data){
                if(data.err!=0){$("#login_err_info").html("*用户名或者密码填写错误")}else{
                    $.ajax({
                        url:'/mainiflogin',
                        dataType:'json',
                        success:function(data){
                            if(data.err!=0){
                                $("#login_err_info").html("*用户名或者密码填写错误");
                            }else{
                                // 微信浏览器，地址没变不触发跳转-_-!
                                // window.location.href = window.location.href+'1' // 这个也是可以的
                                // alert('success2');
                                // location.reload(true);
                                // var to_url = window.location.href+"";
                                window.location.href = 'http://zumd.chinaganzhi.com/lift/detail/nocode';
                            }
                        }
                    })
                }
            },
            error:function(data){
                console.log("errrrr");
                console.log(data);
            }
        });
    })
})
</script>
    
{% endblock %}